//
//  YGLocalTableViewCell.m
//  yuanshangyiliao
//
//  Created by icholab on 2021/3/17.
//

#import "YGLocalTableViewCell.h"
#import "YGGrayVIew.h"
#import "YGHospitalDetailsViewController.h"

@interface YGLocalTableViewCell ()
@property (nonatomic, strong) UIImageView *localMsgImageView;
@property(nonatomic, strong) YGGrayVIew *grayView;



@end
@implementation YGLocalTableViewCell


#pragma private


- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self initView];
        [self initContraints];
    }
    return self;
}

- (void)initView{

    [self addSubview:self.localMsgImageView];
    [self.localMsgImageView addSubview:self.grayView];
    
    
}

- (void)configureData:(HospitalsModel *)model{
    if (model) {
        NSString *imageUrl = model.banner;
        NSURL *url = [NSURL URLWithString:imageUrl];
        [self.localMsgImageView sd_setImageWithURL:url];
        
    }


}

- (void)initContraints{
    [self.localMsgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.height.mas_equalTo(self.mas_height);
        make.left.mas_equalTo(self.mas_left).offset(10);
        make.right.mas_equalTo(self.mas_right).offset(-10);
        make.top.mas_equalTo(self.mas_top).offset(-10);
    }];

    [self.grayView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.height.mas_equalTo(26);
        make.left.right.bottom.mas_equalTo(self.localMsgImageView);

    }];
    
    
}



#pragma setter

- (UIImageView *)localMsgImageView{
    if (!_localMsgImageView) {
        _localMsgImageView = [[UIImageView alloc] init];
        _localMsgImageView.layer.cornerRadius=5;
        _localMsgImageView.clipsToBounds = YES;
        
    }
    return _localMsgImageView;
}
- (UIView *)grayView{
    if (!_grayView) {
        _grayView = [[YGGrayVIew alloc] init];
        _grayView.backgroundColor=UIColorFromRGBAlpha(0x999999, 0.8);
        
    }
    return _grayView;
}


- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
